package hn.cch.custom;

import java.util.Random;
import java.util.UUID;

public class CustomObject {

    private long id;
    private String name;
    private int age;
    private boolean sex;// true-男; false-女;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean isSex() {
        return sex;
    }

    public void setSex(boolean sex) {
        this.sex = sex;
    }

    /**
     * 随机生成对象实例
     * @param seed
     * @return
     */
    public static CustomObject createObject(long seed){
        CustomObject customObject = new CustomObject();
        Random random = new Random(seed);
        customObject.setId(random.nextLong());
        customObject.setName(UUID.randomUUID().toString());
        customObject.setAge(random.nextInt(100));
        customObject.setSex(random.nextBoolean());
        return customObject;
    }
}
